import dataset
import evolution
import population

from tempfile import TemporaryFile
from xlwt import Workbook

fs = ['+','*']
ts = [1,2,5,'x']

ds = dataset.DataSet('simple.xls', ['x','y'])
p = population.genRampedHalf(10,fs,ts,3)


book = Workbook()
sheet1 = book.add_sheet('SSE')

#sheet1.write(0,0,'A1')

for generation in range(50):

    row = 0
    for tree in p:
        sheet1.write(row, generation, evolution.evalSSEofIndividual(tree, ds))
        row += 1

    p = evolution.evs1(p, ds, fs, ts)

    pass

book.save('result.xls')
book.save(TemporaryFile())

print "done!"
